<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();
    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <a href="<?php echo isset($this->queryData['return']) ? $this->url('sales', ['action' => 'detail', 'id' => $this->orderInfo->getOrderId()]) : $this->url('sales', [], ['query' => $this->queryData]);?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回'); ?></a>
            <?php if (empty($this->vGoodsStockFew)) { ?>
                <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('点击发货'); ?></button>
            <?php } ?>
            <?php echo $this->HelpUrl('sendOrderGoodsVirtual'); ?>
        </h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?php echo $this->translate('订单虚拟商品发货'); ?></h3>
                    </div>
                    <div class="box-body">
                        <?php echo $this->partial('layout/messages'); ?>

                        <?php if (!empty($this->vGoodsStockFew)) { ?>
                            <div class="col-sm-12">
                                <div class="alert alert-danger alert-dismissible">
                                    <i class="icon fa fa-exclamation"></i><?php echo $this->translate('将虚拟商品库存补全后，再进行发货处理!'); ?>
                                </div>
                            </div>
                        <?php } ?>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('订单编号'); ?></label>
                            <div class="col-sm-3">
                                <p class="form-control-static"><?php echo $this->escapeHtml($this->orderInfo->getOrderSn()); ?></p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('操作备注'); ?><span class="must_add_value">*</span></label>
                            <div class="col-sm-6">
                                <?php echo $this->formElement($form->get('statusInfo')); ?>
                                <?php echo $this->formElementErrors($form->get('statusInfo'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table shop-table table-bordered">
                            <thead>
                            <tr class="shop-bg-thead">
                                <th width="30%"><?php echo $this->translate('商品名称'); ?></th>
                                <th width="15%"><?php echo $this->translate('商品货号'); ?></th>
                                <th width="15%"><?php echo $this->translate('商品规格'); ?></th>
                                <th width="10%"><?php echo $this->translate('购买数量'); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach($this->orderGoods as $goodsValue) { ?>
                                <tr>
                                    <td>
                                        <img src="<?php echo $this->goodsHelper()->goodsImage($goodsValue->getGoodsImage()); ?>" class="img-thumbnail" style="width: 50px;height: 50px;">
                                        <?php echo $this->escapeHtml($goodsValue->getGoodsName()); ?>
                                        <?php if (isset($this->vGoodsStockFew[$goodsValue->getGoodsId()])) echo '(<span class="text-red">'.$this->translate('需补货数量').'：'.$this->vGoodsStockFew[$goodsValue->getGoodsId()]['num'].'</span>)'; ?>
                                    </td>
                                    <td><?php echo $this->escapeHtml($goodsValue->getGoodsItem()); ?></td>
                                    <td>
                                        <?php if(!empty($goodsValue->getInSpecGoodsStr())) { echo $this->escapeHtml($goodsValue->getInSpecGoodsStr()); } else echo $this->translate('无'); ?>
                                    </td>
                                    <td><?php echo $goodsValue->getBuyNum(); ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <?php echo $this->form()->closeTag(); ?>

</div>
<script>
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                statusInfo: {
                    required: true
                }
            },
            messages: {
                statusInfo: {
                    required: "<?php echo $this->translate('操作备注不能为空!'); ?>"
                }
            }
        });
    });
</script>
